<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
{% extends "bootstrap/base.html" %}
{% block title %}iMonitor - {% endblock %}
{% block head %}
{% block page_styles %}{% endblock %}
{{ super() }}
<link rel="shortcut icon" href="{{ url_for('static', filename = 'favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename = 'favicon.ico') }}" type="image/x-icon">
<link href="https://cdn.bootcss.com/font-awesome/5.13.0/css/all.min.css" rel="stylesheet">
<link href="{{ url_for('static', filename = 'style.css') }}" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/3.0.0/jquery.min.js"></script>

{% endblock %}

{% block navbar %}
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">iMonitor</a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li>
                    <a href="/">主页 <span class="sr-only">(current)</span></a>
                </li>
                {% if current_user and current_user.is_authenticated %}
                <li class="{% if active_menu == 'dashboard' %} active {% endif %}">
                    <a href="{{ url_for('dashboard_view.index') }}">仪表盘</a>
                </li>
                <li class="{% if active_menu == 'host' %} active {% endif %}">
                    <a href="{{ url_for('host_view.index') }}">主机管理</a>
                </li>
                {% endif %}
                <!--                <li class="dropdown">-->
                <!--                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"-->
                <!--                       aria-expanded="false">其他 <span class="caret"></span></a>-->
                <!--                    <ul class="dropdown-menu">-->
                <!--                        <li><a href="/d">404</a></li>-->
                <!--                    </ul>-->
                <!--                </li>-->
            </ul>
            <!--<form class="navbar-form navbar-left">-->
            <!--<div class="form-group">-->
            <!--<input type="text" class="form-control" placeholder="Search">-->
            <!--</div>-->
            <!--<button type="submit" class="btn btn-default">Submit</button>-->
            <!--</form>-->
            {% if current_user and current_user.is_authenticated %}
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        <img src="{{ url_for('static', filename = 'imgs/avatar/' + current_user.avatar) }}"
                             alt="{{current_user.name}}" class="img-circle avatar-w20"/>
                        <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="{{ url_for('settings_view.profile') }}">
                                <span class="fa-stack">
                                    <i class="fas fa-square fa-stack-2x"></i>
                                    <i class="fas fa fa-cog fa-stack-1x fa-inverse"></i>
                                </span> 设置
                            </a></li>
                        <li>
                            <a href="{{ url_for('auth_view.logout') }}">
                                <span class="fa-stack">
                                    <i class="fas fa-square fa-stack-2x"></i>
                                    <i class="fas fa fa-sign-out-alt fa-stack-1x fa-inverse"></i>
                                </span> 退出
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
            {% else %}
            <div class="nav navbar-nav navbar-right">
                <a type="button" class="btn btn-default navbar-btn btn-sm" href="/auth/signin">登 录</a>
                <a type="button" class="btn btn-default navbar-btn btn-sm btn-info" href="/auth/signup">注 册</a>
            </div>
            {% endif %}
        </div>
    </div>
</nav>
{% endblock %}

{% block content %}
<div class="container">
    {% block page_content %}{% endblock %}
</div>
{% endblock %}

{% block scripts %}
{{ super() }}
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
    })
</script>

{{ moment.include_moment(local_js="https://cdn.bootcss.com/moment.js/2.22.1/moment.min.js") }}

{% endblock %}
